#pragma once
#include "GlobalSocket.h"
#include "Data.h"
#include "Process.h"
#include <vector>


using namespace std;

// CPrivateChatDialog dialog

class CPrivateChatDialog : public CDialog
{
	DECLARE_DYNAMIC(CPrivateChatDialog)

public:
	CPrivateChatDialog(CWnd* pParent = NULL);   // standard constructor
	virtual ~CPrivateChatDialog();

// Dialog Data
	enum { IDD = IDD_PRIVATE_CHAT_DIALOG };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual BOOL OnInitDialog();

	DECLARE_MESSAGE_MAP()

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
public:
	// variable
	CWnd *m_pParent;
	CString srcUser;
	CString dstUser;
	CString strServer;
	CGlobalSocket *gSock;
	SOCKET socketParentWindows;
	SOCKET sClient;
	CString sReceivedMessage;
	int sendType;
	int buffLength;
	CListBox *pListMessages;

	// method
	LRESULT SockMsg(WPARAM wParam,LPARAM lParam);
	LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);

	bool initPrivateChat (CString srcUser, CString dstUser, CString strServer, SOCKET socketParentWindows);
	int createPackage(int code);
	int sendPackage (CString msg);
	void choseAction(vector<CString> arrReceivePackage);
	PACKAGE parseMessage(vector<CString> arrCode);
	BOOL PreTranslateMessage(MSG* pMsg);


//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	afx_msg void OnBnClickedBtnSendMessage();
	afx_msg void OnBnClickedBtnSendFile();
	afx_msg void OnClose();
};
